const Student = require('../models/student')

// 添加数据
async function addStudent(studentObj) {
    // 验证 studentObj
    const ins = await Student.create(studentObj)
    return ins.toJSON()
}

// 删除数据
async function deleteStudent(id) {
    await Student.destroy({ where: { id } })
}

// 修改数据
async function updateStudent(id, studentObj) {
    await Student.update(studentObj, { where: { id } })
}

module.exports = { addStudent, deleteStudent, updateStudent }